Skip to content

Conversation

@ccawley2011
Copy link
Contributor

No description provided.

@slouken
Copy link
Collaborator

slouken commented Oct 6, 2025

This needs to be adjusted to match the SDL coding style.

@ccawley2011
Copy link
Contributor Author

This needs to be adjusted to match the SDL coding style.

Could you clarify what needs changing?

{
int i;
for (i = 0; i < players_len; i++) {
if (SDL_GetGamepadID(players[i].gamepad) == gamepad) return i;
Copy link
Contributor

@madebr madebr Oct 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the comment is about not always using curly braces, and indentation.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, for example, here the code would be:

Suggested change
if (SDL_GetGamepadID(players[i].gamepad) == gamepad) return i;
if (SDL_GetGamepadID(players[i].gamepad) == gamepad) {
return i;
}

@slouken slouken added this to the 3.x milestone Oct 9, 2025
}
break;
}
case SDL_EVENT_GAMEPAD_AXIS_MOTION: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand correctly, this event is fired only when the axis value changes. This implementation results in the camera only rotation when you wiggle the thumbstick, instead of the thumbstick controlling the velocity of camera rotation.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's correct. If you want to have control based on state you should just query the axis value instead of responding to an axis change event.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I’m pretty sure the convention is to use the right stick for camera controls rather than left. It’d be a little bit awkward having both movement and aim on the left side of the controller.

@expikr
Copy link
Contributor

expikr commented Oct 24, 2025

What I had in mind while writing the original example was to convey the following two messages to anyone reading the code:

  1. You’ve seen joystick splitscreen before, that’s nothing special. But did you know that Mouse+Keyboard can do local splitscreen too?
  2. Look how little code it takes to get something like this working!

While adding additional device support is technically an improvement, the extra complexity adds a little bit of additional cognitive load to the reader of the example, while not conveying the strictly minimum requirement.

It also somewhat distracts from the uniqueness of mouse/keyboard splitscreen, I’d opine that a pointed omission of joystick support actually showcases the mouse/keyboard functionality better by distancing itself from traditional joystick implementation paradigms.

I think multi-joystick would be better suited to a separate standalone demo, maybe one with a top down cooperative platformer format. It would also better show off the analog directional capabilities of the thumb sticks instead of shoehorning them into a WASD control scheme.

@slouken
Copy link
Collaborator

slouken commented Oct 24, 2025

That's fair feedback, and since @ccawley2011 seems to be away, I'll go ahead and close this for now.

@slouken slouken closed this Oct 24, 2025
@ccawley2011
Copy link
Contributor Author

I probably ought to mention that the main reason for this PR is to better support systems like the 3DS, which doesn't have a keyboard and therefore requires this PR in order to allow input to work at all.

@slouken
Copy link
Collaborator

slouken commented Oct 24, 2025

I probably ought to mention that the main reason for this PR is to better support systems like the 3DS, which doesn't have a keyboard and therefore requires this PR in order to allow input to work at all.

In that case, can you clean up this PR based on our feedback, and I'll go ahead and merge it?

@slouken slouken reopened this Oct 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants